-
Notifications
You must be signed in to change notification settings - Fork 59
add support for migrating cometbft pvcs to hyperdisk #3658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[static] Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
e98e128 to
d767131
Compare
| const svIdentifier = nodeConfigs.selfSvNodeName; | ||
| const svIdentifierWithMigration = `${svIdentifier}-m${migrationId}`; | ||
| let volumeDependecies: Resource[] = []; | ||
| if (svConfiguration?.cometbft?.snapshotName) { | ||
| const volumeSize = cometbftChartValues.db.volumeSize; | ||
| const diskSnapshot = gcp.compute.getSnapshot({ | ||
| name: svConfiguration.cometbft.snapshotName, | ||
| }); | ||
|
|
||
| if (!GCP_ZONE) { | ||
| throw new Error('Zone is required to create a disk'); | ||
| } | ||
| const restoredDisk = new gcp.compute.Disk( | ||
| `${svIdentifierWithMigration}-cometbft-restored-data`, | ||
| { | ||
| name: `${svIdentifierWithMigration}-cometbft-restored-disk`, | ||
| // eslint-disable-next-line promise/prefer-await-to-then | ||
| size: diskSnapshot.then(snapshot => snapshot.diskSizeGb), | ||
| // eslint-disable-next-line promise/prefer-await-to-then | ||
| snapshot: diskSnapshot.then(snapshot => snapshot.selfLink), | ||
| type: 'pd-ssd', | ||
| zone: GCP_ZONE, | ||
| }, | ||
| opts | ||
| ); | ||
|
|
||
| // create the underlying persistent volume that will be used by cometbft from the state of an existing PV | ||
| volumeDependecies = [ | ||
| new k8s.core.v1.PersistentVolume( | ||
| `${svIdentifier}-cometbft-data`, | ||
| { | ||
| metadata: { | ||
| name: `${svIdentifier}-cometbft-data-pv`, | ||
| }, | ||
| spec: { | ||
| capacity: { | ||
| storage: volumeSize, | ||
| }, | ||
| volumeMode: 'Filesystem', | ||
| accessModes: ['ReadWriteOnce'], | ||
| persistentVolumeReclaimPolicy: 'Delete', | ||
| storageClassName: cometbftChartValues.db.volumeStorageClass, | ||
| claimRef: { | ||
| name: `global-domain-${migrationId}-cometbft-cometbft-data`, | ||
| namespace: xns.ns.metadata.name, | ||
| }, | ||
| csi: { | ||
| driver: 'pd.csi.storage.gke.io', | ||
| volumeHandle: restoredDisk.id, | ||
| }, | ||
| }, | ||
| }, | ||
| opts | ||
| ), | ||
| ]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just dead code we use for the cluster migration
martinflorian-da
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| name: {{ include "prefix" (list .Values "cometbft-data") }} | ||
| name: {{ .Values.db.pvcName | default (include "prefix" (list .Values "cometbft-data")) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again I bow before your bravery to change YAML without a test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(looks fairly reasonable to me... but doesn't it always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested manually but also added tests for everything now
[static] Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
[static]
same as #3653 but not it's a deployment, but we set the keep helm values for pvcs so they are not auto deleted
Pull Request Checklist
Cluster Testing
/cluster_teston this PR to request it, and ping someone with access to the DA-internal system to approve it./hdm_teston this PR to request it, and ping someone with access to the DA-internal system to approve it.PR Guidelines
Fixes #n, and mention issues worked on using#nMerge Guidelines